package de.tmahr.android.logger;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class LogActivity extends Activity
{
	private Logger logger;
	private String tag;
	protected TextView textView;

	public LogActivity(String tag)
	{
		super();
		this.tag = tag;
		logger = new LogCatLogger(tag);
	}

	protected void log(String s)
	{
		logger.log(s);
	}
	
	protected void clearLog()
	{
		logger.clearLog();
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setTitle(tag);
		textView = new TextView(this);
		setContentView(textView);
		logger = new BufferedTextViewLogger(tag, textView);
	}	
	
	protected String getLoggedText()
	{
		return logger.getLoggedText();
	}	
}